home *** CD-ROM | disk | FTP | other *** search
- /*
- Yet another header with macros for setting up A4 globals in 68K code resources.
- This handles either Think C or CodeWarrior with minimal fuss.
-
- The main() entry calls EnterResource() ... RestoreA4().
- All other entries call SetUpA4() ... RestoreA4().
-
- CodeWarrior provides 2 headers: <A4Stuff.h> and <SetUpA4.h> which define several
- macros. None of these work as simply as the Think C <SetUpA4.h>.
- */
-
- #ifdef THINK_C
- #include <SetUpA4.h>
- #define EnterResource() RememberA0(); SetUpA4()
- #else
- #define EnterResource() long oldA4 = SetCurrentA4(); SaveA4()
- #define SetUpA4() long oldA4 = RecallA4()
- #define RestoreA4() SetA4(oldA4)
-
- /* stolen from CodeWarrior <SetUpA4.h> */
- long SetCurrentA4(void);
-
- long SetA4(long:__D0):__D0 = 0xC18C;
-
- static void SaveA4(void);
-
- static asm long RecallA4(void)
- {
- move.l a4,d0
- lea storage,a4
- move.l (a4),a4
- rts
-
- storage: dc.l 0
-
- entry static SaveA4
- lea storage,a0
- move.l a4,(a0)
- rts
- }
- #endif
-